package com.red.star.wechat.data.core.base;

import com.alibaba.fastjson.JSON;
import com.red.star.wechat.data.entity.SesameCommonResponse;
import com.red.star.wechat.data.entity.SesameCommonData;
import com.red.star.wechat.data.utils.SesameUtil;
import org.apache.http.HttpException;

import java.io.IOException;
import java.net.URISyntaxException;

public class SesameDemo {
    public static void main(String[] args) throws IOException, HttpException, URISyntaxException {
//        String a = SesameUtil.getOperateLog("1","10000","Molli","operation");
        String source = "27f2250a9aeb11e8acf1027f90066cee";
        String deviceId = "40a5ef5f69b0";
        String b = SesameUtil.deviceStatus(deviceId);
        System.out.println(b);
        SesameCommonResponse response = JSON.parseObject(b, SesameCommonResponse.class);
        String code = response.getCode();
        SesameCommonData data = response.getData();
        String id = data.getId();
        String deviceid = data.getDeviceid();
        String status = data.getStatus();
        String onlineDur = data.getOnline_dur();
        System.out.println("code====>" + code);
        System.out.println(id);
        System.out.println(deviceid);
        System.out.println(status);
        System.out.println(onlineDur);

//        String code = "{\"code\":1000,\"data\":[{\"content\":\"\\u8bbe\\u5907\\u4e0a\\u7ebf\",\"time\":\"2018-10-11 07:36:01\"},{\"content\":\"\\u8bbe\\u5907\\u79bb\\u7ebf\",\"time\":\"2018-10-10 18:52:06\"}],\"total\":186,\"error_msg\":[]}";
//        SesameResponse sesameResponse =  JSON.parseObject(code, SesameResponse.class);
//        code = JSON.toJSONString(sesameResponse);
//        System.out.println(code);
    }

}
